package com.xuecheng.orders.service;

import com.alipay.api.AlipayApiException;
import com.xuecheng.messagesdk.model.po.MqMessage;
import com.xuecheng.orders.model.dto.AddOrderDto;
import com.xuecheng.orders.model.dto.PayRecordDto;
import com.xuecheng.orders.model.dto.PayStatusDto;
import com.xuecheng.orders.model.po.XcPayRecord;
import org.springframework.transaction.annotation.Transactional;


import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Author xiao
 * @Date 2024/12/25 下午 2:20
 * @ClassName: OrderService
 * @Description: 订单支付接口
 */
public interface OrderService {

    /**
     * @param addOrderDto 订单信息
     * @return PayRecordDto 支付记录(包括二维码)
     * @description 创建商品订单
     * @author Mr.M
     * @date 2022/10/4 11:02
     */
    public PayRecordDto createOrder(String userId, AddOrderDto addOrderDto);


    /**
     * @param payNo
     * @return
     * @Desc: 请求支付接口
     */
    public void requestpay(HttpServletRequest httpRequest,
                           HttpServletResponse httpResponse, String payNo) ;


    /**
     * @description 查询支付记录
     * @param payNo  交易记录号
     * @return com.xuecheng.orders.model.po.XcPayRecord
     * @author Mr.M
     * @date 2022/10/20 23:38
     */
    public XcPayRecord getPayRecordByPayno(String payNo);

    /**
     * @param payNo
     * @return
     * @Desc: 根据交易单号返回查询结果
     */
    public PayStatusDto queryPayResultFromAlipay(String payNo);
    /**
     * @param payNo
     * @return
     * @Desc: 根据订单号但会查询结果
     */
    PayRecordDto queryPayResult(String payNo);


    /**
     * @param payStatusDto
     * @return
     * @Desc: 修改支付记录状态及修改订单状态
     */
    public void saveAliPayStatus(PayStatusDto payStatusDto);
    
    /**
     * @param message 
     * @return 
     * @Desc: 发送通知结果
     */
    public void notifyPayResult(MqMessage message);
}
